//
//  DetailTableHeaderView.m
//  PropertyMananger
//
//  Created by Mansion on 16/12/31.
//  Copyright © 2016年 BH. All rights reserved.
//

#import "DetailTableHeaderView.h"

@implementation DetailTableHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        NSInteger HeaderH = 150;
        UILabel * nickNameLabel = [[UILabel alloc]init];
        [self addSubview:nickNameLabel];
      //  nickNameLabel.backgroundColor = BHRandColor;
        
        nickNameLabel.text = @"姓     名:";
        nickNameLabel.textColor = BHColor(102, 102, 102);
        nickNameLabel.font = BHFont(15);
        
        [nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(15);
            make.top.equalTo(self).with.offset(HeaderH/4 - 25);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        UIView * line1 = [[UIView alloc]init];
        [self addSubview:line1];
        line1.backgroundColor = BHColor(230, 230, 230);
        
        [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(nickNameLabel).with.offset(0);
            make.top.equalTo(nickNameLabel.mas_bottom).with.offset(12.5);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 15, 1));
        }];
        
        UIView * line2 = [[UIView alloc]init];
        [self addSubview:line2];
          line2.backgroundColor = BHColor(230, 230, 230);
        
        [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(line1).with.offset(0);
            make.top.equalTo(line1.mas_bottom).with.offset(50);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 15, 1));
        }];
        
        self.nickNameLabel = [[UILabel alloc]init];
        [self addSubview:self.nickNameLabel];
        self.nickNameLabel.text = @"陈小白";
        
        self.nickNameLabel.textColor = BHColor(51, 51, 51);
        self.nickNameLabel.font = BHFont(15);
        self.nickNameLabel.textAlignment = NSTextAlignmentLeft;
        
        [self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(nickNameLabel.mas_trailing).with.offset(0);
            make.top.equalTo(nickNameLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 25));
        }];
        
        //性别
        
        UILabel * sexLabel = [[UILabel alloc]init];
        [self addSubview:sexLabel];
        sexLabel.text = @"性     别:";
        
        sexLabel.textColor = BHColor(102, 102, 102);
        sexLabel.font = BHFont(15);
        
        [sexLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(nickNameLabel).with.offset(0);
            make.top.equalTo(line1).with.offset(12.5);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.sexLabel = [[UILabel alloc]init];
        [self addSubview:self.sexLabel];
        self.sexLabel.text = @"男";
        
        self.sexLabel.textColor = BHColor(51, 51, 51);
        self.sexLabel.font = BHFont(15);
        self.sexLabel.textAlignment = NSTextAlignmentLeft;
        
        [self.sexLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(sexLabel.mas_trailing).with.offset(0);
            make.top.equalTo(sexLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/4, 25));
        }];
        
        //手机号
        UILabel * phoneNumLabel = [[UILabel alloc]init];
        [self addSubview:phoneNumLabel];
        phoneNumLabel.text = @"手  机  号:";
        
        phoneNumLabel.textColor = BHColor(102, 102, 102);
        phoneNumLabel.font = BHFont(15);
        
        [phoneNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(nickNameLabel).with.offset(0);
            make.top.equalTo(line2).with.offset(12.5);
            make.size.mas_equalTo(CGSizeMake(70, 25));
        }];
        
        self.phoneLabel = [[UILabel alloc]init];
        [self addSubview:self.phoneLabel];
        self.phoneLabel.text = @"134573747747";
        
        self.phoneLabel.textColor = BHColor(51, 51, 51);
        self.phoneLabel.font = BHFont(15);
        self.phoneLabel.textAlignment = NSTextAlignmentLeft;
        
        [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(phoneNumLabel.mas_trailing).with.offset(0);
            make.top.equalTo(phoneNumLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/3, 25));
        }];
        
        //拨打电话
        self.phoneButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:self.phoneButton];
        [self.phoneButton setImage:IMG(@"ico_dial_telephone") forState:UIControlStateNormal];
        
        [self.phoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).with.offset(-20);
            make.top.equalTo(phoneNumLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(30, 30));
        }];


        
    }
    return self;
}

@end
